package com.mengrv.springbootdemo.tool;

import sun.misc.BASE64Encoder;

import java.security.MessageDigest;

public class MD5Tool {
    public static String getMd5String(String string) throws Exception {
        MessageDigest md5 = MessageDigest.getInstance("MD5");
        BASE64Encoder base64 = new BASE64Encoder();
        return base64.encode(md5.digest(string.getBytes("utf-8")));
    }
}
